package com.softfly.flink;

import org.apache.flink.api.common.io.RichOutputFormat;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.types.Row;

import java.io.IOException;

public class RandomOutputFormat extends RichOutputFormat<Row> {
    private int id = -1;

    @Override
    public void configure(Configuration configuration) {

    }

    @Override
    public void open(int id, int num) throws IOException {
        this.id = id;
    }

    @Override
    public void writeRecord(Row row) throws IOException {
        String line = row.getField(0) + ", " + row.getField(1);
        System.out.println("writeRecord: " + line);
    }

    @Override
    public void close() throws IOException {

    }
}
